{template "header.html"}
<div class="note note-danger">
    <p><a href="javascript:dr_update_cache();">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>

<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title tabbable-line">
            <ul class="nav nav-tabs" style="float:left;">
                <li class="{if !$page}active{/if}">
                    <a href="#tab_0" data-toggle="tab" onclick="$('#dr_page').val('0')"> <i class="fa fa-cog"></i> {dr_lang('官微设置')} </a>
                </li>
                {loop $module $i $t}
                <li class="{if $page==$i}active{/if}">
                    <a href="#tab_{$i}" data-toggle="tab" onclick="$('#dr_page').val('{$i}')"> <i class="{dr_icon($t.icon)}"></i> {$t.name} </a>
                </li>
                {/loop}
            </ul>
        </div>
        <div class="portlet-body">
            <div class="tab-content">


                <div class="tab-pane {if !$page}active{/if}" id="tab_0">
                    <div class="form-body">

                        <div class="form-group">
                            <label class="col-md-2 control-label">站点共享</label>
                            <div class="col-md-9">
                                <input type="checkbox" name="data[share]" value="1" {if $data['share']}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <span class="help-block">{dr_lang('开启共享之后微博将授权信息将全站通用')}</span>
                            </div>
                        </div>
                        {if $weibo}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('微博名称')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {dr_html2emoji($weibo.nickname)} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('授权周期')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {date('Y-m-d H:i:s', $weibo.expire_at)} </p>
                            </div>
                        </div>
                        {/if}
                        <div class="form-group">
                            <label class="col-md-2 control-label">App Key</label>
                            <div class="col-md-9">
                                <input type="text" name="data[key]" value="{$data.key}" class="form-control input-inline input-medium">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">App Secret</label>
                            <div class="col-md-9">
                                <label><input type="text" name="data[secret]" value="{$data.secret}" class="form-control input-large"></label>
                                <label><a target="_blank" href="{dr_url('api/weibo')}" class="btn btn-success">{dr_lang('一键更新授权')}</a></label>
                            </div>
                        </div>


                    </div>
                </div>

                {loop $module $i $m}
                <div class="tab-pane {if $i == $page}active{/if}" id="tab_{$i}">
                    <div class="form-body">

                        <div class="form-group">
                            <label class="col-md-2 control-label">{$m.name}</label>
                            <div class="col-md-9">

                                <input type="checkbox" name="data[module][{$i}][use]" value="1" {if $data['module'][$i]['use']}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <span class="help-block">{dr_lang('后台发布内容时同步到官微之中')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('默认选中')}</label>
                            <div class="col-md-9">

                                <input type="checkbox" name="data[module][{$i}][open]" value="1" {if $data['module'][$i]['open']}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <span class="help-block">{dr_lang('发布内容时是否默认选中开关')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('自定义图片字段')}</label>
                            <div class="col-md-9">
                                <label><select class="form-control" name="data[module][{$i}][image]">
                                    <option value=""> -- </option>
                                    {loop $m.field $t}
                                    {if in_array($t.fieldtype, ['File', 'Files', 'Ueditor'])}
                                    <option value="{$t.fieldname}" {if $data['module'][$i]['image'] == $t.fieldname}selected{/if}>{$t.name}</option>
                                    {/if}
                                    {/loop}
                                </select></label>
                                <span class="help-block">{dr_lang('默认将同步缩略图字段')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('自定义内容字段')}</label>
                            <div class="col-md-9">
                                <label><select class="form-control" name="data[module][{$i}][content]">
                                    <option value=""> -- </option>
                                    {loop $m.field $t}
                                    {if in_array($t.fieldtype, ['Textarea', 'Text'])}
                                    <option value="{$t.fieldname}" {if $data['module'][$i]['content'] == $t.fieldname}selected{/if}>{$t.name}</option>
                                    {/if}
                                    {/loop}
                                </select></label>
                                <span class="help-block">{dr_lang('默认将同步描述字段')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('将Tag作为话题插入')}</label>
                            <div class="col-md-9">

                                <input type="checkbox" name="data[module][{$i}][istag]" value="1" {if $data['module'][$i]['istag']}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <span class="help-block">{dr_lang('当内容中无话题时才将Tag作为话题放到内容的前面，如#Tag1# #Tag2#')}</span>
                            </div>
                        </div>

                    </div>
                </div>
                {/loop}





            </div>
        </div>
    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存')}</button>
        </div>
    </div>
</form>



{template "footer.html"}